﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/
#region Imports

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

using VisualAgile.IBLL;
using VisualAgile.IDAL;
using VisualAgile.Model;

#endregion


namespace VisualAgile.BLL
{
    public class RoleManager : BaseManager<Role>, IRoleManager 
    {
        #region Properties

        public IRoleDao RoleDao { get; set; }

        #endregion

        protected override IBaseDao<Role> getBaseDAO()
        {
            return RoleDao;
        }

        /// <summary>
        /// New Role
        /// </summary>
        /// <returns></returns>
        public Role NewRole()
        {
            var project = new Role();

            //Create Time
            project.CreateTime = DateTime.Now;

            return project;
        }

        /// <summary>
        /// Access to Role
        /// </summary>
        /// <param name="RoleName">project Id</param>
        /// <returns></returns>
        public Role GetByName(string RoleName)
        {
            return RoleDao.FindByName(RoleName);
        }

        /// <summary>
        /// Access to Role
        /// </summary>
        /// <param name="RoleName">project Id</param>
        /// <returns></returns>
        public Role GetById(int? RoleId)
        {
            return RoleDao.FindById(RoleId);
        }

        private void Validate(Role project)
        {
            //TODO throw exception on error.
        }
    }
}
